#include"process.h"
#include<string.h>
#include <unistd.h>

#define type '#'
#define num 101


void flush(double total,double current)
{
	 char buff[num];
        memset(buff,0,sizeof(buff));
        static int cnt = 0;

        char* fuhao = "|/-\\";
	int Num = (int)(current*100 /total);
	for(int i =0;i<Num;i++)
	{
		buff[i]=type;
	}
	double rate = current / total;
	
	printf("[%-100s][%.1f%%][%c]\r",buff,rate*100,fuhao[cnt%4]);
	cnt++;
	fflush(stdout);
	
}







//实际中无法使用
void prijdt()
{
	char buff[num];
	memset(buff,0,sizeof(buff));
	int cnt = 0;
	
	char* fuhao = "|/-\\";
	
	while(cnt<=100)
	{
	
		printf("[%-100s][%d%%][%c]\r",buff,cnt,fuhao[cnt%4]);
		fflush(stdout);
		buff[cnt]=type;
		cnt++;
		
		usleep(100000);
	}
	printf("\n");
}

	
